import { httpRequest } from "@/utils/https.js"
import {baseUrl} from "@/utils/basic.js"
//产品列表
export const allGoodsList = (page,pagesize,type,keyword,cat_id) =>
	httpRequest(baseUrl+'index.php?m=api&c=wxapp&a=indexAllGoodsList', {
        page,
		pagesize,
		type,
		keyword,
		cat_id
	},'get')
//产品列表其他数据
export const IndexGoods = () =>
	httpRequest(baseUrl+'index.php?m=api&c=wxapp&a=otherListByIndexGoods', {
		
	},'get')
//产品详情
export const goodsDetails = (id) =>
	httpRequest(baseUrl+'index.php?m=api&c=wxapp&a=goodsDetails', {
        id
	},'get')
//购物车列表
export const orderCart = (data)=>
    httpRequest(baseUrl+'index.php?m=api&c=wxapp&a=orderCart',data,'get')
//添加至购物车	
export const saveOrderCart = (data)=>
	httpRequest(baseUrl+'index.php?m=api&c=wxapp&a=saveOrderCart',data,'post')
//匿名添加购物车
export const batchSaveOrderCart = (data)=>
	httpRequest(baseUrl+'index.php?m=api&c=wxapp&a=batchSaveOrderCart',data,'post')    
//购物车删除商品
export const deleteOrderCart =(username,ids)=>
	httpRequest(baseUrl+'index.php?m=api&c=wxapp&a=deleteOrderCart',{
		username,
		ids
	},'post')
//获取地址
export const getExpress =(username,id,money)=>
	httpRequest(baseUrl+'index.php?m=api&c=wxapp&a=getExpress',{
		username,
		id,
		money
	},'get')
//购物车数量
export const orderCartChange =(username,id,num)=>
	httpRequest(baseUrl+'index.php?m=api&c=wxapp&a=orderCartChange',{
		username,
		id,
		num
	},'post')
//主站相关分类
export const getRelatedGoodsCategory = (cat_id) =>
    httpRequest(baseUrl+'index.php?m=api&c=wxapp&a=getRelatedGoodsCategory',{
    	cat_id
    },'get')